/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.nxlv2.nomad.businessobjects;

import java.util.ArrayList;
import java.util.Date;
import org.joda.time.DateTime;

/**
 *
 * @author Xavier
 */
public class Commande {

    private int idBase, idAppli, idAdresseFacturation, idAdresseLivraison;
    private long numCommande;
    private Date date;
    private EtatCommande etatCommande;
    private ArrayList<DetailCommande> listDetailCommande;
    private Satisfaction satisfaction;

    public Commande() {
    }

    /**
     *
     * @param idBase
     * @param idAppli
     * @param date
     * @param etatCommande
     * @param listDetailCommande
     * @param satisfaction
     */
    public Commande(int idBase, int idAppli, long numCommande, Date date, EtatCommande etatCommande, int idAdresseFacturation, int idAdresseLivraison, ArrayList<DetailCommande> listDetailCommande, Satisfaction satisfaction) {
        this.idBase = idBase;
        this.idAppli = idAppli;
        this.date = date;
        this.numCommande=numCommande;
        this.etatCommande = etatCommande;
        this.idAdresseFacturation = idAdresseFacturation;
        this.idAdresseLivraison = idAdresseLivraison;
        this.listDetailCommande = listDetailCommande;
        this.satisfaction = satisfaction;
    }

    /**
     *
     * @param idBase
     * @param idAppli
     * @param date
     * @param etatCommande
     */
    public Commande(int idBase, int idAppli, Date date, EtatCommande etatCommande, int idAdresseFacturation, int idAdresseLivraison) {
        this.idBase = idBase;
        this.idAppli = idAppli;
        this.date = date;
        this.etatCommande = etatCommande;
        this.idAdresseFacturation=idAdresseFacturation;
        this.idAdresseLivraison=idAdresseLivraison;
    }

    /**
     *
     * @return idBase
     */
    public int getIdBase() {
        return idBase;
    }

    /**
     *
     * @param idBase
     */
    public void setIdBase(int idBase) {
        this.idBase = idBase;
    }

    /**
     *
     * @return idAppli
     */
    public int getIdAppli() {
        return idAppli;
    }

    /**
     *
     * @param idAppli
     */
    public void setIdAppli(int idAppli) {
        this.idAppli = idAppli;
    }

    /**
     *
     * @return date
     */
    public Date getDate() {
        return date;
    }

    /**
     *
     * @param date
     */
    public void setDate(Date date) {
        this.date = date;
    }

    /**
     *
     * @return etatCommande
     */
    public EtatCommande getEtatCommande() {
        return etatCommande;
    }

    /**
     *
     * @return etatCommande
     */
    public String getLibelleEtatCommande() {
        return etatCommande.getLibelle();
    }

    /**
     *
     * @param etatCommande
     */
    public void setEtatCommande(EtatCommande etatCommande) {
        this.etatCommande = etatCommande;
    }

    /**
     *
     * @return listDetailDemande
     */
    public ArrayList<DetailCommande> getListDetailCommande() {
        return listDetailCommande;
    }

    /**
     *
     * @param listDetailCommande
     */
    public void setListDetailCommande(ArrayList<DetailCommande> listDetailCommande) {
        this.listDetailCommande = listDetailCommande;
    }

    /**
     *
     * @return satisfaction
     */
    public Satisfaction getSatisfaction() {
        return satisfaction;
    }

    /**
     *
     * @param satisfaction
     */
    public void setSatisfaction(Satisfaction satisfaction) {
        this.satisfaction = satisfaction;
    }
    /**
     * 
     * @return idAdresseFacturation
     */
    public int getIdAdresseFacturation() {
        return idAdresseFacturation;
    }
    /**
     * 
     * @param idAdresseFacturation 
     */
    public void setIdAdresseFacturation(int idAdresseFacturation) {
        this.idAdresseFacturation = idAdresseFacturation;
    }
    /**
     * 
     * @return idAdresseLivraison
     */
    public int getIdAdresseLivraison() {
        return idAdresseLivraison;
    }
    /**
     * 
     * @param idAdresseLivraison 
     */
    public void setIdAdresseLivraison(int idAdresseLivraison) {
        this.idAdresseLivraison = idAdresseLivraison;
    }

    public long getNumCommande() {
        return numCommande;
    }

    public void setNumCommande(long numCommande) {
        this.numCommande = numCommande;
    }
    

    /**
     *
     * @return String
     */
    @Override
    public String toString() {
//        return "Commande{" + "idBase=" + idBase + ", idAppli=" + idAppli + ", date=" + date + ", etatCommande=" + etatCommande + ", listDetailCommande=" + listDetailCommande + ", satisfaction=" + satisfaction + '}';
        return new DateTime(date).toString("dd/MM/YYYY");
    }
    
    public String toJSONString(){
        return "{\"idBase\":\""+ idBase +"\",\"idAppli\":\""+ idAppli +"\",\"date\":\""+ date +"\",\"numCommande\":\""+ numCommande +"\",\"etatCommande\":\""+ etatCommande.getLibelle() +"\",\"idAdresseFacturation\":\""+ idAdresseFacturation +"\",\"idAdresseLivraison\":\""+ idAdresseLivraison +"\"}";
    }
}
